import wsgiserver
def my_crazy_app(environ, start_response):
  status = '200 OK'
  print environ['REMOTE_ADDR']
  response_headers = [('Content-type','text/plain')]
  start_response(status, response_headers)
  return ['Hello world!\n']
  
def my_crazy_app2(environ, start_response):
  status = '200 OK'
  response_headers = [('Content-type','text/plain')]
  start_response(status, response_headers)
  return ['Hello world2!\n']
#server = wsgiserver.CherryPyWSGIServer(
#  ('0.0.0.0', 8070), my_crazy_app,
#  server_name='www.cherrypy.example')

d = wsgiserver.WSGIPathInfoDispatcher({'/': my_crazy_app, '/blog/': my_crazy_app2})
server = wsgiserver.CherryPyWSGIServer(('0.0.0.0', 8000), d)

if __name__ == '__main__':
  try:
    server.start()
  except KeyboardInterrupt:
    server.stop()